﻿using System;
using System.Collections.Generic;
using System.Linq;

public class Utility
{
    public static IEnumerable<T> Sort<T, TKey>(IEnumerable<T> source, Func<T, TKey> keySelector, bool ascending = true)
    {
        return ascending ? source.OrderBy(keySelector) : source.OrderByDescending(keySelector);
    }
}

